package org.batatasframework.support.database.values;

import java.sql.ResultSet;

import org.batatasframework.support.database.sql.field.SelectFragment;


public class ObjectValueHolder extends AbstractSingleValueHolder{

	public ObjectValueHolder(SelectFragment field, String alias) {
		super(field, alias);
	}

	@Override
	public FieldValue read(ResultSet rs) throws Exception {
		return new ObjectValue(rs.getObject(alias));
	}

	@Override
	public StatisticsTotal createStatistics() {
		return null;
	}
	
	class ObjectValue extends AbstractValue<Object>{
		
		public ObjectValue(Object value){
			super(value);
		}

		@Override
		public Object targetValue() {
			return value == null ? "" : value;
		}
	}
}
